﻿@model IFDB.ViewModels.PartialViewModels.Interfaces.ICompetitionMatchListViewModel

@Html.Partial("~/Views/Shared/Match/_MatchPaginationControl.cshtml", Model)

<table class="MatchList">

    @foreach (var group in Model.CompetitionMatchList.GroupBy(item => item.MatchDate.Date))
    {
        foreach (var item in group.Take(1))
        {
            <thead>
                <tr>
                    <th class="Date" colspan="3">
                        @string.Format("{0} {1}", Model.GetDayPrefix(item.MatchDate), item.MatchDate.ToString("MMMM yyyy"))
                    </th>
                </tr>
            </thead>
        }

        foreach(var item in group.OrderBy(g => g.Team1.TeamName))
        {
        <tr>
            <td class="LeftTeam">@Html.ActionLink(item.Team1.TeamName, "Index", "Team", new { teamId = item.Team1.TeamId }, null)</td>
            <td class="Score">v</td>
            <td class="RightTeam">@Html.ActionLink(item.Team2.TeamName, "Index", "Team", new { teamId = item.Team2.TeamId }, null)</td>
        </tr>
        }
    }

</table>